package com.k8.registry;

import com.k8.rpc.registry.Registry;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class RegistryManager {
    Lock lock = new ReentrantLock();
    Map<String, Registry> cacheRegistry = new HashMap<>(20);

    public Lock getLock() {
        return lock;
    }

    public void setLock(Lock lock) {
        this.lock = lock;
    }

    public RegistryManager() {
    }

    public Map<String, Registry> getCacheRegistry() {
        return cacheRegistry;
    }

    public void setCacheRegistry(Map<String, Registry> cacheRegistry) {
        this.cacheRegistry = cacheRegistry;
    }


    public void putRegistry(String registryCacheKey, Registry registry) {
        cacheRegistry.put(registryCacheKey, registry);
    }
}
